import java.io.*;
import java.net.*;

public class RaxiServer{
	public static void main(String[] args) throws Exception{
		ServerSocket ss=new ServerSocket(4407);
		int nr=0;
		while(true){
			Socket sc=ss.accept();
			System.out.println(sc);
			PrintWriter vorku=new PrintWriter(sc.getOutputStream(), true);
			nr++;
			vorku.println("Sa oled juba "+nr+". jobu, kes mind ruineerib.");
			vorku.println("Kes sa kurat oled?");
			BufferedReader br=new BufferedReader(new InputStreamReader(sc.getInputStream()));
			String kirjeldus=br.readLine();
			vorku.println("Haige lohh oled, "+kirjeldus+"! Osta aju endale!");
			sc.close();
		}
	}
}